import React from 'react'
import WithDva from '../util/store';
import MyLayout from '../component/mylayout/mylayout'

class Error extends React.Component {
    static getInitialProps({res, err}) {
        const statusCode = res ? res.statusCode : err ? err.statusCode : null;
        return {statusCode}
    }

    render() {
        return (<MyLayout>
                <div className={"p404"}>
                    <div>
                        <img src="http://pfn7a6ibm.bkt.clouddn.com/p404.png" alt=""/>
                    </div>
                    <p className={"ppp"}>
                        {this.props.statusCode
                            ? `An error ${this.props.statusCode} occurred on server`
                            : 'An error occurred on client'}
                    </p>
                </div>
                <style jsx>{`
.p404{
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}
.ppp{
margin-top:20px;
font-size:30px;
}
                `}</style>
            </MyLayout>
        )
    }
}

export default WithDva((state) => {
    return {store: state}
})(Error)